//
//  UIBarButtonItem+Extension.m
//  YuDou
//
//  Created by qiupeng on 2018/6/24.
//  Copyright © 2018年 yingqi. All rights reserved.
//

#import "UIBarButtonItem+Extension.h"

@implementation UIBarButtonItem (Extension)

+ (UIBarButtonItem *)itemWithImageName:(NSString *)imageName highlightedImage:(NSString *)highlightedImage size:(CGSize)size
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    if (highlightedImage.length) {
        [btn setImage:[UIImage imageNamed:highlightedImage] forState:UIControlStateHighlighted];
    }
    btn.frame = CGRectMake(0, 0, size.width, size.height);
   return [[UIBarButtonItem alloc]initWithCustomView:btn];
}

@end
